{extend name="Index/index" /}
{block name="table"}
	<!-- END SIDEBAR -->
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content"  style=" min-height: 700px;">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
							<h4 class="modal-title">Modal title</h4>
						</div>
						<div class="modal-body">
							 Widget settings form goes here
						</div>
						<div class="modal-footer">
							<button type="button" class="btn blue">Save changes</button>
							<button type="button" class="btn default" data-dismiss="modal">Close</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal-dialog -->
			</div>
			<!-- /.modal -->
			<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<!-- BEGIN STYLE CUSTOMIZER -->
			<div class="theme-panel hidden-xs hidden-sm">
				<!-- <div class="toggler">
				</div> -->
				<div class="toggler-close">
				</div>
				<div class="theme-options">
					<div class="theme-option theme-colors clearfix">
						<span>
							 THEME COLOR
						</span>
						<ul>
							<li class="color-black current color-default" data-style="default">
							</li>
							<li class="color-blue" data-style="blue">
							</li>
							<li class="color-brown" data-style="brown">
							</li>
							<li class="color-purple" data-style="purple">
							</li>
							<li class="color-grey" data-style="grey">
							</li>
							<li class="color-white color-light" data-style="light">
							</li>
						</ul>
					</div>
					<div class="theme-option">
						<span>
							 Layout
						</span>
						<select class="layout-option form-control input-small">
							<option value="fluid" selected="selected">Fluid</option>
							<option value="boxed">Boxed</option>
						</select>
					</div>
					<div class="theme-option">
						<span>
							 Header
						</span>
						<select class="header-option form-control input-small">
							<option value="fixed" selected="selected">Fixed</option>
							<option value="default">Default</option>
						</select>
					</div>
					<div class="theme-option">
						<span>
							 Sidebar
						</span>
						<select class="sidebar-option form-control input-small">
							<option value="fixed">Fixed</option>
							<option value="default" selected="selected">Default</option>
						</select>
					</div>
					<div class="theme-option">
						<span>
							 Sidebar Position
						</span>
						<select class="sidebar-pos-option form-control input-small">
							<option value="left" selected="selected">Left</option>
							<option value="right">Right</option>
						</select>
					</div>
					<div class="theme-option">
						<span>
							 Footer
						</span>
						<select class="footer-option form-control input-small">
							<option value="fixed">Fixed</option>
							<option value="default" selected="selected">Default</option>
						</select>
					</div>
				</div>
			</div>
			<!-- END STYLE CUSTOMIZER -->
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title">
					站内消息
					</h3>
					<ul class="page-breadcrumb breadcrumb">
						<!-- <li class="btn-group">
							<button type="button" class="btn blue dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">
							<span>
								Actions
							</span>
							<i class="fa fa-angle-down"></i>
							</button>
							<ul class="dropdown-menu pull-right" role="menu">
								<li>
									<a href="#">
										Action
									</a>
								</li>
								<li>
									<a href="#">
										Another action
									</a>
								</li>
								<li>
									<a href="#">
										Something else here
									</a>
								</li>
								<li class="divider">
								</li>
								<li>
									<a href="#">
										Separated link
									</a>
								</li>
							</ul>
						</li> -->
						<li>
							<i class="fa fa-home"></i>
							<a href="{:url('index/index/index')}">
								Home
							</a>
							<i class="fa fa-angle-right"></i>
						</li>
						<!-- <li>
							<a href="#">
								Extra
							</a>
							<i class="fa fa-angle-right"></i>
						</li> -->
						<li>
							<a href="{:url('index/Inbox/index')}">
								站内消息
							</a>
						</li>
					</ul>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			<div class="row inbox">
				<div class="col-md-2">
					<ul class="inbox-nav margin-bottom-10">
						<li class="compose-btn">
							<a href="{:url('index/Inbox/mail')}" data-title="Compose" class="btn green">
								<i class="fa fa-edit"></i> 写邮件
							</a>
						</li>
						<li class="compose-btn">
							<a href="{:url('index/Inbox/notice')}" data-title="Compose" class="btn green">
								<i class="fa fa-edit"></i> 发布公告
							</a>
						</li>
						<li class="inbox active">
							{if $num == 0}
							<a href="{:url('index/Inbox/index')}" class="btn" data-title="Inbox">
								 收件箱
							</a>
							<b></b>
							{else /}
							<a href="{:url('index/Inbox/index')}" class="btn" data-title="Inbox">
								 收件箱(<?php echo $num;?>)
							</a>
							<b></b>
							{/if}
						</li>
						<li class="draft">
							{if $num2 == 0}
							<a class="btn" href="{:url('index/Inbox/checknotice')}" data-title="Notice">
								 系统消息
							</a>
							<b></b>
							{else /}
							<a class="btn" href="{:url('index/Inbox/checknotice')}" data-title="Notice">
								 系统消息(<?php echo $num2;?>)
							</a>
							<b></b>
							{/if}
						</li>
						<li class="sent">
							<a class="btn" href="{:url('index/Inbox/sent')}" data-title="Sent">
								 已发送
							</a>
							<b></b>
						</li>
						
						<li class="trash">
							<a class="btn" href="{:url('index/Inbox/trash')}" data-title="Trash">
								 垃圾箱
							</a>
							<b></b>
						</li>
						
					</ul>
				</div>
				<div class="col-md-10">
					<div class="inbox-header">
						<h1 class="pull-left">收件箱</h1>
						<form class="form-inline pull-right" action="{:url('index/Inbox/search')}" method="get">
							<div class="input-group input-medium">
								<input type="text" class="form-control" placeholder="搜索" name="search">
								<span class="input-group-btn">
									<button type="submit" class="btn green"><i class="fa fa-search"></i></button>
								</span>
							</div>
						</form>
					</div>
					<div class="inbox-loading">
						 Loading...
					</div>
					<div class="inbox-content">
						<table class="table table-striped table-advance table-hover">
							<thead>
							<tr>
								<th colspan="3">
									<div class="checker">
										<span class="">  
											<input type="checkbox" class="mail-checkbox mail-group-checkbox quanxuan">
										</span>
									</div>
									<div class="btn-group">
									<div class="btn-group">
										<a class="btn btn-sm blue" href="#" data-toggle="dropdown">
											 操作 <i class="fa fa-angle-down"></i>
										</a>
										<ul class="dropdown-menu">
											<!-- <li>
												<a href="#">
													<i class="fa fa-pencil"></i> Mark as Read
												</a>
											</li>
											<li>
												<a href="#">
													<i class="fa fa-ban"></i> Spam
												</a>
											</li>
											<li class="divider">
											</li> -->
											<li>
												<!-- <a href="{:url('index/Inbox/del')}"> -->
													<!-- <button class="shanchu btn-sm btn-default"> 
													<i class="fa fa-trash-o"></i> 删除
													</button> -->
													<a class="shanchu btn-default"  href="javascript:;"><i class="fa fa-pencil"></i>删除</a>
												<!-- </a> -->
											</li>
										</ul>
									</div>
								</th>
								<th class="pagination-control" colspan="3">
									
								</th>
								<th class="pagination-control" colspan="3"></th>
							</tr>
							</thead>
							<tbody>
							{if empty($amount)}
							<tr data-messageid="4">
								<td class="inbox-small-cells">
									<div class="checker">
										<input type="checkbox" id="" value="option1" name="choose">
									</div>
									<!-- <div class="checker">
										<span>
											<input type="checkbox" class="mail-checkbox">
										</span>
									</div> -->
								</td>
								<td class="inbox-small-cells">
								</td>
								<td class="view-message hidden-xs">
									 	<span>暂无消息</span>
								
								</td>
								
								<td class="view-message">
								
								<td class="view-message inbox-small-cells">
								</td>
								<td class="view-message text-right">
								</td>
							</tr>
							{else /}
							
							{volist name="$amount" id="vo"}
							<!--  style="background-color: #DCDCDC;" -->
							<tr data-messageid="4">
								<td class="inbox-small-cells">
									<!-- <div>
										<input type="checkbox" id="" value="option1">
									</div> -->
									<div class="checker">
										<span>
											<input type="checkbox" class="" name="choose" value="{$vo.mail_id}" id="input">
										</span>
									</div>
								</td>
								<td class="inbox-small-cells">
								</td>
								<!-- 已读未读的css区别 -->
								{if condition="$vo.is_read neq 1"}
									<td class="view-message hidden-xs">
								<a style="text-decoration: none;" href="{:url('index/Inbox/check',['id'=>$vo['mail_id']])}">
									 	<span  style="font-weight: bold;color: black;" class="txt_title">{$vo.mail_title}</span>
								</a>
									</td>
									<td class="view-message">
								<a style="text-decoration: none;" href="{:url('index/Inbox/check',['id'=>$vo['mail_id']])}">
										<span  style="font-weight: bold;color: black;" class="txt_content">
										{$vo.mail_show_content}
										</span>
								</a>
									</td>
								<!--  -->
								{else /}
									<td class="view-message hidden-xs">
								<a style="text-decoration: none;color: black;" href="{:url('index/Inbox/check',['id'=>$vo['mail_id']])}">
									 
									 	<span class="txt_title">{$vo.mail_title}</span>
								</a>
									</td> 
									<td class="view-message">
								<a style="text-decoration: none;color: black;" href="{:url('index/Inbox/check',['id'=>$vo['mail_id']])}">
									<span class="txt_content">
									{$vo.mail_show_content}
									</span>
								</a>
									</td>
								{/if}
								<td class="view-message">
								</td>
								
								<td class="view-message inbox-small-cells">
								</td>
								<td class="view-message text-right">
									 {$vo.create_time}
								</td>
							</tr>
							
							
							{/volist}

							{/if}

							<!-- <tr data-messageid="6">
								<td class="inbox-small-cells">
									<div class="checker"><span><input type="checkbox" class="mail-checkbox"></span></div>
								</td>
								<td class="inbox-small-cells">
									<i class="fa fa-star inbox-started"></i>
								</td>
								<td class="view-message hidden-xs">
									 Facebook
								</td>
								<td class="view-message">
									 Dolor sit amet, consectetuer adipiscing
								</td>
								<td class="view-message inbox-small-cells">
									<i class="fa fa-paperclip"></i>
								</td>
								<td class="view-message text-right">
									 March 14
								</td>
							</tr> -->
							
							</tbody>
							</table>

					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="footer">
	<div class="footer-inner">
		 2018 &copy; 仁聚科技
	</div>
	<div class="footer-tools">
		<span class="go-top">
			<i class="fa fa-angle-up"></i>
		</span>
	</div>
</div>
<link rel="stylesheet" type="text/css" href="/static/assets/css/pages/inbox.css" />

<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="/static//static/assets/plugins/respond.min.js"></script>
<script src="/static/assets/plugins/excanvas.min.js"></script> 
<![endif]-->
<script src="/static/assets/plugins/fancybox/source/jquery.fancybox.pack.js" type="text/javascript"></script>
<script src="/static/assets/plugins/bootstrap-wysihtml5/wysihtml5-0.3.0.js" type="text/javascript"></script>
<script src="/static/assets/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.js" type="text/javascript"></script>
<!-- BEGIN:File Upload Plugin JS files-->
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="/static/assets/plugins/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
<!-- The Templates plugin is included to render the upload/download listings -->
<script src="/static/assets/plugins/jquery-file-upload/js/vendor/tmpl.min.js"></script>
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
<script src="/static/assets/plugins/jquery-file-upload/js/vendor/load-image.min.js"></script>
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
<script src="/static/assets/plugins/jquery-file-upload/js/vendor/canvas-to-blob.min.js"></script>
<!-- blueimp Gallery script -->
<script src="/static/assets/plugins/jquery-file-upload/blueimp-gallery/jquery.blueimp-gallery.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="/static/assets/plugins/jquery-file-upload/js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
<script src="/static/assets/plugins/jquery-file-upload/js/jquery.fileupload.js"></script>
<!-- The File Upload processing plugin -->
<script src="/static/assets/plugins/jquery-file-upload/js/jquery.fileupload-process.js"></script>
<!-- The File Upload image preview & resize plugin -->
<script src="/static/assets/plugins/jquery-file-upload/js/jquery.fileupload-image.js"></script>
<!-- The File Upload audio preview plugin -->
<script src="/static/assets/plugins/jquery-file-upload/js/jquery.fileupload-audio.js"></script>
<!-- The File Upload video preview plugin -->
<script src="/static/assets/plugins/jquery-file-upload/js/jquery.fileupload-video.js"></script>
<!-- The File Upload validation plugin -->
<script src="/static/assets/plugins/jquery-file-upload/js/jquery.fileupload-validate.js"></script>
<!-- The File Upload user interface plugin -->
<script src="/static/assets/plugins/jquery-file-upload/js/jquery.fileupload-ui.js"></script>

  	<script type="text/javascript">
	   $(".txt_title").each(function() {
		var maxwidth = 20;//显示多少字符
		if ($(this).text().length > maxwidth) {
		$(this).text($(this).text().substring(0, maxwidth));
		$(this).html($(this).html() + '...');
		}
		});
	   $(".txt_content").each(function() {
		var maxwidth = 30;//显示多少字符
		if ($(this).text().length > maxwidth) {
		$(this).text($(this).text().substring(0, maxwidth));
		$(this).html($(this).html() + '...');
		}
		});
    </script>
	<script>
		$(function(){
			$('.inbox').addClass("active");
		});
	</script>
<!-- <script>
jQuery(document).ready(function() {       
   // initiate layout and plugins
   App.init();
   // Inbox.init();
   TableAjax.init();
});
</script> -->
<!-- END JAVASCRIPTS -->
<script>

for(var i = 0;i< $('input').length;i++){
 
    (function () {
        $('input')[i].onclick = function () {
            // $(this).parent().addClass('checked');    
            // if ($(this).parent().prop("checked");) {}
            if($(this).parent().hasClass('checked')){
            	$(this).parent().removeClass('checked'); 
            }else{
            	$(this).parent().addClass('checked'); 
            }
        }
    })(i);
}
</script>
<script>
	$(function(){
	var p = [];
	$('.shanchu').click(function(){
	for(i = 0; i < $('.checked').length;i++){
		p[i] = $('.checked').eq(i).find('input').val();
	}
	console.log(p);
      postdata();
});

     function postdata(){     
         //提交数据函数   
        toastr.options = {  
            closeButton: true,  
            debug: false,  
            progressBar: true,  
            positionClass: "toast-top-right",  
            onclick: null,  
            showDuration: "1000",  
            hideDuration: "1000",  
            timeOut: "1000",  
            extendedTimeOut: "1000",  
            showEasing: "swing",  
            hideEasing: "linear",  
            showMethod: "fadeIn",  
            hideMethod: "fadeOut"  
        };
        $.ajax({                                                  //调用jquery的ajax方法   
          type: "POST",                                      //设置ajax方法提交数据的形式   
          url: '/index/Inbox/del',                                        
          data: {
                  id : p
              }, 
          success: function(data){       
          if (data) {
            toastr.success('删除成功');
            setInterval(function(){
              location.reload(true);
            }, 1000);
          }else{
            toastr.error('删除失败，请重试');
              location.reload(true);
            
          }
        },
        error: function () {
                alert('请选择要删除的消息');
            }
        });   
     }   
    })
</script>
<script>
	$('.quanxuan').click(function(){
			// console.log(13);
			var q = [];
			if($('input').eq(2).parent().hasClass('checked')){
				for (var i = 1;i < $('input').length ; i ++) {
						$('input').eq(i).parent().removeClass('checked');
					} 
				
			}else{
				for (var i = 1;i < $('input').length ; i ++) {
						$('input').eq(i).parent().addClass('checked');
					}
			}
			for(i = 0; i < $('.checked').length;i++){
			q[i] = $('.checked').eq(i).find('input').val();
		// q = q.slice(1);
		   ok = q.slice(2);
		console.log(ok);
	}
	});
</script>
<link href="/static/assets/css/toastr.min.css" rel="stylesheet"/>
<script src="/static/assets/js/toastr.min.js" rel="stylesheet"/></script>

</body>
<!-- END BODY -->
</html>
{/block}